﻿using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Text;

namespace Savage.DotNetLibrary.BulkSmsLibrary
{
    public class SendSmsInfo
    {
        private string _userName;
        public string UserName
        {
            get { return _userName; }
            set { _userName = value; }
        }

        private string _password;
        public string Password
        {
            get { return _password; }
            set { _password = value; }
        }

        private string _message;
        /// <summary>
        /// Max 160 chars for text, max 280 chars for 8bit.
        /// </summary>
        public string Message
        {
            get { return _message; }
            set { _message = value; }
        }

        private Collection<string> _recipients = new Collection<string>();
        /// <summary>
        /// List of phone numbers to send this message to.
        /// </summary>
        public Collection<string> Recipients
        {
            get { return _recipients; }
        }

        private Collection<int> _groupIds = new Collection<int>();
        /// <summary>
        /// List of numeric group ids (we recommend a maximum of 5000 recipients across all groups to minimise timeouts).
        /// </summary>
        public Collection<int> GroupIds
        {
            get { return _groupIds; }
        }

        private string _sender;
        /// <summary>
        /// sender id / origin address (if alphanumeric, max 11 characters). This facility becomes available after credits have been purchased for the first time. To request a sender id, log into your account, go to User Account and click Change Sender ID. Alphanumeric sender id is a route-specific feature.
        /// </summary>
        public string Sender
        {
            get { return _sender; }
            set { _sender = value; }
        }

        private MessageClassOption _messageClass = MessageClassOption.Default;
        public MessageClassOption MessageClass
        {
            get { return _messageClass; }
            set { _messageClass = value; }
        }

        private DataCodingAlphabetOption _dataCodingAlphabet = DataCodingAlphabetOption.Default;
        /// <summary>
        /// 7bit,8bit or 16bit, default 7bit (normal text message). For 8bit (ringtones,logos) or 16bit (Unicode), a message containing only hexadecimal octets, to a maximum of 140 octets (where an octet is e.g. ff), must be submitted (the UDHI is always set for 8-bit messages). 16-bit is a route-specific feature.
        /// </summary>
        public DataCodingAlphabetOption DataCodingAlphabet
        {
            get { return _dataCodingAlphabet; }
            set { _dataCodingAlphabet = value; }
        }

        private bool _wantReport;
        public bool WantReport
        {
            get { return _wantReport; }
            set { _wantReport = value; }
        }

        private RoutingGroupOption _routingGroup = RoutingGroupOption.Standard;
        /// <summary>
        /// Routing groups group delivery routes by cost or quality.
        /// </summary>
        public RoutingGroupOption RoutingGroup
        {
            get { return _routingGroup; }
            set { _routingGroup = value; }
        }

        private string _sourceId;
        /// <summary>
        /// An alphanumeric (plus other common characters) id, for your own accounting purposes (e.g. useful if you have subaccounts that you send messages on behalf of, or even if you have your own unique id that you want to associate with the message). Max 20 characters.
        /// </summary>
        public string SourceId
        {
            get { return _sourceId; }
            set { _sourceId = value; }
        }

        private bool? _repliable;
        /// <summary>
        /// Enable or disable, default is not set (null), which means that your User Profile's default repliable setting will prevail.
        /// </summary>
        public bool? Repliable
        {
            get { return _repliable; }
            set { _repliable = value; }
        }

        private bool _stripDuplicateRecipients;
        /// <summary>
        /// Normally we return an error if your list of recipients is not unique. This setting causes the duplicates to rather be stripped and the messages be sent. Not recommended: you should rather validate your data properly.
        /// </summary>
        public bool StripDuplicateRecipients
        {
            get { return _stripDuplicateRecipients; }
            set { _stripDuplicateRecipients = value; }
        }

        private int? _stopDupId;
        /// <summary>
        /// The optional parameter stop_dup_id takes an integer as an argument, in the range 1 to 2147483647. If you submit a message with a stop_dup_id that you have recently (within the past few hours) used in another submission, then that submission will not be processed.
        /// </summary>
        public int? StopDupId
        {
            get { return _stopDupId; }
            set { _stopDupId = value; }
        }

        private DateTime? _sendTime;
        /// <summary>
        /// scheduled send time (see section on scheduling below), relative to the time zone specified for your account.
        /// </summary>
        public DateTime? SendTime
        {
            get { return _sendTime; }
            set { _sendTime = value; }
        }

        private string _schedulingDescription;
        /// <summary>
        /// If using scheduling, you could provide a description of the scheduled job here to later help identify it.
        /// </summary>
        public string SchedulingDescription
        {
            get { return _schedulingDescription; }
            set { _schedulingDescription = value; }
        }

        private bool _allowConcatenation;
        /// <summary>
        /// Enable sending of messages longer than 160 characters 
        /// </summary>
        public bool AllowConcatenation
        {
            get { return _allowConcatenation; }
            set { _allowConcatenation = value; }
        }

        private int _maxConcatenatedMessageParts = 2;
        /// <summary>
        /// Maximum number of message parts to allow when concatenating (default: 2).
        /// </summary>
        public int MaxConcatenatedMessageParts
        {
            get { return _maxConcatenatedMessageParts; }
            set { _maxConcatenatedMessageParts = value; }
        }

        public override int GetHashCode()
        {
            string postData = BulkSmsHttpApi.GetPostData(this);
            return postData.GetHashCode();
        }
    }
}
